package com.magicsoft.app.helper;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

/**
 * 
 * @author www.coortouch.com
 * 
 */
public class WIFIHelper {
	
	
	Context context;

	public WIFIHelper(Context context) {

		this.context = context;
	}

	public static int checkWIFI(Context context) {

		ConnectivityManager connManager = (ConnectivityManager) context
				.getSystemService(Context.CONNECTIVITY_SERVICE);
		 NetworkInfo info=connManager.getActiveNetworkInfo();

			if(info!=null){
			 if(info.getType()==ConnectivityManager.TYPE_WIFI){
				 return 0;  //wifi
			 }else if(info.getType()==ConnectivityManager.TYPE_MOBILE){
				 return 1;  //2G/3G
			 }else{
				 return 2;
			 }
			}else{
				 return 2;
			}
		
	}
}
